UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qLCGo8oue3MppZHr5K/9UXk6mbFaBbh2W7q9sgYbDXs=' 
WHERE 
  key_id = '00f2c16897fa5fb6e713204eff13d08436380b43ae15d389d7123d6b2b0f8727' 
  AND (
    token = 'qLCGo8oue3MppZHr5K/9UXk6mbFaBbh2W7q9sgYbDXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040