UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vtrg+czlIywzAJBWVmIKlzFpMlUekfTXKY1JsuXfgic='
WHERE
key_id = 'ac8af109a0c7829f2e53403d5c28d7827592b8ce821e5b0d2760bf1ef7252474'
AND (
token = 'vtrg+czlIywzAJBWVmIKlzFpMlUekfTXKY1JsuXfgic='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)