UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZIOTrfA5pA4HLZAgqHFwgIrmEY/SSmycGb6/LYCei3I='
WHERE
key_id = 'f87445bd0965523ee4fd5b6c0a4a3d9f27ea8083d84650a40286e75dd782a44c'
AND (
token = 'ZIOTrfA5pA4HLZAgqHFwgIrmEY/SSmycGb6/LYCei3I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)