UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Onves7RDMPpxS9REm0E/7C7ciwHcUuHp4rwOVDSdEs='
WHERE
key_id = 'bf412a3bc1650ffbd3695e738cec23df16e0a871ed1042dbd5b45a072b514a02'
AND (
token = '6Onves7RDMPpxS9REm0E/7C7ciwHcUuHp4rwOVDSdEs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)