UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYrYZtJNks671I4IqtFsXMCSlZfh/Cph3etxELMNhko=' 
WHERE 
  key_id = 'b982a3362ba42367fc2c5cc6f2b2e18f93a3cdb3bb94a343fda216d544ebe36d' 
  AND (
    token = 'DYrYZtJNks671I4IqtFsXMCSlZfh/Cph3etxELMNhko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029