UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bDSZd5OnP8rqWc+AC/ll/QhqnaVkTSUA/V8QujxkwVM='
WHERE
key_id = '02c8c3244ef678f6708558ac31d0f24990499e7e1c9edb23077ae43f51959c32'
AND (
token = 'bDSZd5OnP8rqWc+AC/ll/QhqnaVkTSUA/V8QujxkwVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)