UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MdTdvEdnVqODVC7znDYRW6Y8EZR7Aw+Kc7If+tGQiBk='
WHERE
key_id = '22a5c35440b613a76ccd77fccbd71300f7f5a1a363e86904e04f232115511c49'
AND (
token = 'MdTdvEdnVqODVC7znDYRW6Y8EZR7Aw+Kc7If+tGQiBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)