UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/mIaM1i56UEnkIq0NZqJFYhdoRAGsyg59L+Plgzzt6U='
WHERE
key_id = 'cf971fd4e14743071ebd56162f74fe3438c3c38fb17e4a8475c32cfa3da5f786'
AND (
token = '/mIaM1i56UEnkIq0NZqJFYhdoRAGsyg59L+Plgzzt6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)