UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2QCIUjDlr0+z8jLI+/GGwMeF6SDwCjTZL2oWUs09EV4='
WHERE
key_id = 'a33a84f2cf67af75f18c1f9983a961b1a5443e481656d0d8d7e705a9260ef2bd'
AND (
token = '2QCIUjDlr0+z8jLI+/GGwMeF6SDwCjTZL2oWUs09EV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)