UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5DHtyG14ixYxjrbYSp9pWYTgmDfdYrKc6am2RWf1w+0='
WHERE
key_id = 'f6384bb3e3c582ea497a7f0f82baa71c39d1a388273b6c4fbf013af6b84a6a21'
AND (
token = '5DHtyG14ixYxjrbYSp9pWYTgmDfdYrKc6am2RWf1w+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)