UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z4vyh24P+bnn2EDJFkoaehcpsD9QDiz38FyXMf8ZFM4='
WHERE
key_id = 'df7b0ef68616c9f619c553884c429af04cf1f95db8eebe7d3307205182c16f31'
AND (
token = 'Z4vyh24P+bnn2EDJFkoaehcpsD9QDiz38FyXMf8ZFM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)