UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qOcqNoRxcjYQC/l3dKsv1bOilqkHuriPvG57+NSsFvk='
WHERE
key_id = 'f6859e23a1eaaf0aa0acaece4a4bc7f65558d2c2e59907748c04c5edc26ee4a9'
AND (
token = 'qOcqNoRxcjYQC/l3dKsv1bOilqkHuriPvG57+NSsFvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)