UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bhLuggbQa7yUZQ2W9VeAvdZMiChh6tcJZIhYjLHwvG4='
WHERE
key_id = 'a0a654a79a18125d20bf8a2ec72d0045c9c8f80045c5333acbeeaad3f82ea972'
AND (
token = 'bhLuggbQa7yUZQ2W9VeAvdZMiChh6tcJZIhYjLHwvG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)