UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZYe1H6E6puhYT24IyECh8oegRvO95DgzUU6mBp0eD2s=' 
WHERE 
  key_id = 'd80997e07aa22a6522e8911673b8b63c9874b064cdf0720c01dce6638bb51f60' 
  AND (
    token = 'ZYe1H6E6puhYT24IyECh8oegRvO95DgzUU6mBp0eD2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00088