UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '66nhvW6TU+ebD53eQCEPUc47bMuOWscKWbTMnG2fCew='
WHERE
key_id = '06cf2538794dd877e42d97603a6c197f65a5283da2c45553fa43e082d8f49ebe'
AND (
token = '66nhvW6TU+ebD53eQCEPUc47bMuOWscKWbTMnG2fCew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)