UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A9izZH2TP36IFEFzrgyCCFdvFav6wZrjGKQh63eVEAA=' 
WHERE 
  key_id = '1d1df49dbc2a47e3fea164b76e4512865c289aa0b28aab966344ae1f31158845' 
  AND (
    token = 'A9izZH2TP36IFEFzrgyCCFdvFav6wZrjGKQh63eVEAA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031