UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z94JWnEK+2Qv5igrBFNecp91L02+wwqsp3SMuXQhy4Q=' 
WHERE 
  key_id = 'fcb2e6fdd36c0cda9a6e438260b45a3034fe55435de1da72130d46362d6a87bf' 
  AND (
    token = 'Z94JWnEK+2Qv5igrBFNecp91L02+wwqsp3SMuXQhy4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028