UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rP/YAOlOIGZYos7QDgpDn3jyS6tMeQjL+fao6/CcWG0=' 
WHERE 
  key_id = '27191ff663135ad26f02b01542fed395aaa067f12fe9422e1e3cdc67212f54dd' 
  AND (
    token = 'rP/YAOlOIGZYos7QDgpDn3jyS6tMeQjL+fao6/CcWG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040