UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cLTJSLQ9J08kA+QMTXVY52qtgCG7AUiU8JolfV7rntY='
WHERE
key_id = 'fe62234b0ce12b4b5b4021c60fc579c2d64936b293478d991d20b062c68e305d'
AND (
token = 'cLTJSLQ9J08kA+QMTXVY52qtgCG7AUiU8JolfV7rntY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)