UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CpZjegj9DDXIpLm97iIz6knXLRFzzaV9cZEBzI4rPDA=' 
WHERE 
  key_id = '1814b17dd51ba081e3a5282b6eafd92ee2280286bc152c83362524345d519683' 
  AND (
    token = 'CpZjegj9DDXIpLm97iIz6knXLRFzzaV9cZEBzI4rPDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046