UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SPNH5rzsdx8MzZiWBfuSn423s/mvXs4dsO2u8UG3Ue4='
WHERE
key_id = '795c3121882255fd5888733e32a853d09d722b5078072723862e96662d8039b7'
AND (
token = 'SPNH5rzsdx8MzZiWBfuSn423s/mvXs4dsO2u8UG3Ue4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)