UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NcR5eBuQFCwRhhifKrN9y6iU4fdAXGCTSTVWzTHAOt4=' 
WHERE 
  key_id = '1a38747c85d9db2d5d3cf735c5f22b8907b2f0e2fc4faf44cfd8028f74778d62' 
  AND (
    token = 'NcR5eBuQFCwRhhifKrN9y6iU4fdAXGCTSTVWzTHAOt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029