UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WJ9uEnF5EizaREXK00lX457G4A3hoqfdStdxBSI+i+s=' 
WHERE 
  key_id = 'a35be6584c4ebd5c91506c2dfc917b77914d2458c6d73e38e12380078aec4e5a' 
  AND (
    token = 'WJ9uEnF5EizaREXK00lX457G4A3hoqfdStdxBSI+i+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049