UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jTQIDlQKUEsL0EXNHV0MXUL8mLQiI9qW1RyriOFQDvE='
WHERE
key_id = '40db41496a4a31a4377d94cbb27aabc9601487468aa45a91c9102aa5795f3565'
AND (
token = 'jTQIDlQKUEsL0EXNHV0MXUL8mLQiI9qW1RyriOFQDvE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)