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