UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '08fQx0tYuqf2VF5qt+AlOdzruEhT12G7Gphq5lOEFy8=' 
WHERE 
  key_id = 'a32ce3771b6a48435ef09ee8894b5e69c55a78bc19bd43976a15118bd0c27122' 
  AND (
    token = '08fQx0tYuqf2VF5qt+AlOdzruEhT12G7Gphq5lOEFy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047