UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYNtJ9DuyPdKn8bMLRsxgRhueNh/xX8+Dl7tQKI3ZPk=' 
WHERE 
  key_id = 'c6a07d753d7f0651f2713c72b091a047a3583e23c166ee5c9287fa9a164a53a0' 
  AND (
    token = 'cYNtJ9DuyPdKn8bMLRsxgRhueNh/xX8+Dl7tQKI3ZPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030