UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j+g4ofvSyg1s2DWWZ3G3HmCGu32cICQlvUB8mGB8GhY='
WHERE
key_id = '828ed473c9015698c121f965f85ad0cb9895292ce18dacf75d5adc2abf98cc2a'
AND (
token = 'j+g4ofvSyg1s2DWWZ3G3HmCGu32cICQlvUB8mGB8GhY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)