UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1fy+fOuX4uvq9NPoP0uV69WyeYqDN3tw+guHe+TEgOs='
WHERE
key_id = 'd2fd386e84f95f6f7f514e32e5db3bedc4d3c40eb69e7357023354da065e1697'
AND (
token = '1fy+fOuX4uvq9NPoP0uV69WyeYqDN3tw+guHe+TEgOs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)