UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q3F15CyqBKy8CxPnn3atD4M0maFAyiS3Me+rp0463EI=' 
WHERE 
  key_id = '3419ec6fab9e9343dc4087139a5a83477f9f5ae2c91b29f4621b5b233878d57d' 
  AND (
    token = 'Q3F15CyqBKy8CxPnn3atD4M0maFAyiS3Me+rp0463EI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00085