UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ERZaTRBU8nRyVVm7sABABSQYua51LBOlyGqUf8kJCx0='
WHERE
key_id = '4c6ce6598ed5bb94c85781370221a9573cf881191bc475c2814f521321268181'
AND (
token = 'ERZaTRBU8nRyVVm7sABABSQYua51LBOlyGqUf8kJCx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)