UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cbHVdFi5lCzS30MKSmJwCYIM3nMXoXZrQ4kQaARS6co=' 
WHERE 
  key_id = 'c1846bb6b639730bcb686867f7e2101667179b3f78b5c37e82450932439579ad' 
  AND (
    token = 'cbHVdFi5lCzS30MKSmJwCYIM3nMXoXZrQ4kQaARS6co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043