UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2aUZ1N7P0/leeseC7UT/4itcQ7yLZsfD7MkTkLJulb0=' 
WHERE 
  key_id = 'd317989c8860a630825e8b657a0dc2b283663c3b5cdcc086fd80d23699516c81' 
  AND (
    token = '2aUZ1N7P0/leeseC7UT/4itcQ7yLZsfD7MkTkLJulb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032