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

Query time 0.00034