UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tkMfxSA36KEg+F8abuvIIC0p9I+goLySrRdAEuGJm2o='
WHERE
key_id = 'd52831ab3360197292207520d3a6afaa94b87bd5d805b69e8ab60b9eee7e3ecc'
AND (
token = 'tkMfxSA36KEg+F8abuvIIC0p9I+goLySrRdAEuGJm2o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)