UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UTR6Lbb7o5lMIxLM20DgZo4HhAScq/DOr+JX0Fdq1Kw=' 
WHERE 
  key_id = '6003cee9a2ca3c32c6b88e2322f0f98f564e2221797fc23b9df364afade0537e' 
  AND (
    token = 'UTR6Lbb7o5lMIxLM20DgZo4HhAScq/DOr+JX0Fdq1Kw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036