UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bbLMTmV6tIuy0GqfEdNZgB6y5wAUs+LYJJDy72STliA=' 
WHERE 
  key_id = '8a24f94d7867becf2d4e6fa68f550fb5a2134b2fe3413acf12f88b52a243cc58' 
  AND (
    token = 'bbLMTmV6tIuy0GqfEdNZgB6y5wAUs+LYJJDy72STliA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046