UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Km34fXCmHBsFXV6ZDah4ZtPynG836lwX1unf55NegrQ='
WHERE
key_id = '6a52be7569e7b8fe4567472394f1dcd1889a9eda239d698d7c245351ef70e871'
AND (
token = 'Km34fXCmHBsFXV6ZDah4ZtPynG836lwX1unf55NegrQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)