UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ix9tnEHi2+DVtmBlgTSMUONKD6KDW+xHofJY3H1Ba9E=' 
WHERE 
  key_id = 'd1118ca688f2390dd99ba105fb0043f7d32bb56c417437283f41bc64e2d88d40' 
  AND (
    token = 'ix9tnEHi2+DVtmBlgTSMUONKD6KDW+xHofJY3H1Ba9E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032