UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e1h3hNOxYmlx0AfW3BapuS5pdNUUrV9guxVH9cScfrc='
WHERE
key_id = '3f808ece45457324353e2adf249a1161a89dfc8bcdaa5ebe8025cd4a66128cf0'
AND (
token = 'e1h3hNOxYmlx0AfW3BapuS5pdNUUrV9guxVH9cScfrc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)