UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bL4O8WFvyTmf2AkVrfEP7tq8tkK1qUQ8turmoQKKwaA=' 
WHERE 
  key_id = 'b593a8861c04ea4014b1905d89a79d3ec6479a3b52a36e88ccff0a54e3e8567a' 
  AND (
    token = 'bL4O8WFvyTmf2AkVrfEP7tq8tkK1qUQ8turmoQKKwaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030