UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k3YbLaz3k1B2hkkdcPpDc9ELBwQK3sQTw0T2ScIcow8=' 
WHERE 
  key_id = '76b48c5ea4fa2126c4f79d6b5963150af092a55ef8e999cc89241ef609412265' 
  AND (
    token = 'k3YbLaz3k1B2hkkdcPpDc9ELBwQK3sQTw0T2ScIcow8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021