UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jtZUgU14kf+Gk3gxU1WN0CVTsaIGxtrlnpGavDuCOvw='
WHERE
key_id = 'dd512bce320e023433647510fb157eafe5e0041b3875914cc352d5af14eac2f6'
AND (
token = 'jtZUgU14kf+Gk3gxU1WN0CVTsaIGxtrlnpGavDuCOvw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)