UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mzJgDPbKqSorIclEp7owO7Y+fl/e2N5Hhv//9/sSoWo=' 
WHERE 
  key_id = '7cae8068dfeee1651dae724791e486e577991e05963ffbd7da104499ee427ed4' 
  AND (
    token = 'mzJgDPbKqSorIclEp7owO7Y+fl/e2N5Hhv//9/sSoWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023