UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gvV1ymqVocGcfPtZQjr7MOehjQQXOGU7nNCWk6z5PnY='
WHERE
key_id = '1d9844c5628a9625476f316c1b955601b28f308b0d5e19f4b57c5aab074f4ff3'
AND (
token = 'gvV1ymqVocGcfPtZQjr7MOehjQQXOGU7nNCWk6z5PnY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)