UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3MPPI+e8yLD9RSBZ7vSwV279mJnLgqz9U8oDee0CsHY='
WHERE
key_id = 'bbb2da47bb920bcb12074865f757b03670604600bb2f4af1c0aa2ac5383ca860'
AND (
token = '3MPPI+e8yLD9RSBZ7vSwV279mJnLgqz9U8oDee0CsHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)