UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7BvMBa1s/+fGkggxL141n/WcwDhEfw4xdSiH0Gp9anc=' 
WHERE 
  key_id = '05f41e46cbdf551a3e590413d560bb8fbf117339b19c89be9367be65dcae8cf3' 
  AND (
    token = '7BvMBa1s/+fGkggxL141n/WcwDhEfw4xdSiH0Gp9anc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037