UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8GeEkflo7Taq0sKdiQYf5Y45P6TfXKwvMiz8sJXOUk8=' 
WHERE 
  key_id = '0331ad6ce9a6475bb0f2c695fd4634d9052bfd46b5b2b018e53ba6a4a907078a' 
  AND (
    token = '8GeEkflo7Taq0sKdiQYf5Y45P6TfXKwvMiz8sJXOUk8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034