UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '20Nt5h2GVKiPWzRwm0IwyN2Upc1kNiIVRdF+y/4Zxq0='
WHERE
key_id = '6418491b0ef9633ba5123ec0a03a734cd593c8585bee483fcc7c4190750e108c'
AND (
token = '20Nt5h2GVKiPWzRwm0IwyN2Upc1kNiIVRdF+y/4Zxq0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)