UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nDlQrJX+DfMYnlTvj6kdWC0GudiRwJm4EcrltAjTNEA='
WHERE
key_id = 'c30cfc09d950f2aca56580018f895cddfb67688f6f98201f3ab7f893b969a1ad'
AND (
token = 'nDlQrJX+DfMYnlTvj6kdWC0GudiRwJm4EcrltAjTNEA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)