UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U6r6+aUywUlOWqIqQk5A/me+baxYfd346Jbj6B48CHY='
WHERE
key_id = 'd38d6288f8e9d562496396b23379beec40b462e15bf2a1eb8b74711a20e1d791'
AND (
token = 'U6r6+aUywUlOWqIqQk5A/me+baxYfd346Jbj6B48CHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)