UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'h7unaMeY2T34Ijrm3sdwKd9wAmca+pfEp4Ex45baueI='
WHERE
key_id = '2385de82c26c99987c5d5425fbbedc2358d6ed3e175f80f3bb9b8836d367d3d7'
AND (
token = 'h7unaMeY2T34Ijrm3sdwKd9wAmca+pfEp4Ex45baueI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)