UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r3Fyn6JGX5108Eq+fADIzfWSMKXh2IZH8iC3YGrG1oA='
WHERE
key_id = 'fb5b7cfd64bf5f5f0f7b6d1d11887429820867e0368f58146a983c060c778fe5'
AND (
token = 'r3Fyn6JGX5108Eq+fADIzfWSMKXh2IZH8iC3YGrG1oA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)