UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8y7BBzpiKw3tGpdPTr/1uOifM2ZAh+gs7Mfqk8XX5I4=' 
WHERE 
  key_id = '3216d602b4615387c3b1a143cc6db5ffdd8ed104a27cfaf9be24183fd75fe826' 
  AND (
    token = '8y7BBzpiKw3tGpdPTr/1uOifM2ZAh+gs7Mfqk8XX5I4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00125