UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TeqwdmozdkQhR7OOsNsQ65GemaclOa+alvhervn6X4A=' 
WHERE 
  key_id = '48b8c93e19b390a0da74cd9cc882dc45e4639b8329a68c8ce52555556fb58b21' 
  AND (
    token = 'TeqwdmozdkQhR7OOsNsQ65GemaclOa+alvhervn6X4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018