UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c3AyRCQdhsuA74S/aOaokkpm3SanMBQFov3Fa5ZckHk=' 
WHERE 
  key_id = 'cd5367cf14c57d37ff54c48512a81994d1e8fa8d00e11b5995fc403f4f9b4ebe' 
  AND (
    token = 'c3AyRCQdhsuA74S/aOaokkpm3SanMBQFov3Fa5ZckHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041