UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZhg1eGRofXCqiVpoWH3JWiH4gf6rF7yQkWeVyDnnK0=' 
WHERE 
  key_id = '36a3e7ce2f3b7ae6f01e439390dafee333eff7cb84fc0e3d8179fe0a1dc874d1' 
  AND (
    token = 'TZhg1eGRofXCqiVpoWH3JWiH4gf6rF7yQkWeVyDnnK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020