UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XhluSxqAu9XfDHHiByvkB9ri2Wz4e8E9ugGoDvI2238=' 
WHERE 
  key_id = '6b2cee2bf045c7e20fab97029f0dd2884266be3cac73023576c4049cad05968d' 
  AND (
    token = 'XhluSxqAu9XfDHHiByvkB9ri2Wz4e8E9ugGoDvI2238=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028