UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'esZBTMFM6dFk8DGNleoLAauK75USuLwyhehEyrxE3Zw='
WHERE
key_id = 'd84c9541f111a0f21ad42b58824aba3fa7efbfc3e1d0b2f388ded99c3d6f861f'
AND (
token = 'esZBTMFM6dFk8DGNleoLAauK75USuLwyhehEyrxE3Zw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)